package com.yuanfengerp.basicInfoManage.customerInfo.contorller;

import com.yuanfengerp.basicInfoManage.customerInfo.model.Customerinfo;
import com.yuanfengerp.basicInfoManage.customerInfo.service.impl.CustomerinfoserviceImpl;
import com.yuanfengerp.publicUtil.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

@RestController
@CrossOrigin
public class CustomerCon {
    @Autowired
    CustomerinfoserviceImpl ciil;


    // 查询全部客户信息
    @PostMapping("/selectCustomerAll")
    public Result<List<Customerinfo>> selectCustomerAll(@RequestBody Map<String ,Object> params){
        return ciil.selectCustomerAll(params);
    }

    // 添加客户信息
    @PostMapping("/addCustomer")
    public Result<String> addCustomer(@RequestBody Customerinfo customerinfo){
        return ciil.addCustomer(customerinfo);
    }

    // 修改客户信息
    @PostMapping("/updateCustomer")
    public Result<String> updateCustomer(@RequestBody Customerinfo customerinfo){
        return ciil.updateCustomer(customerinfo);
    }

    // 查询单个客户信息
    @PostMapping("/selectCustomer")
    public Result<Customerinfo> selectCustomer(String id){
        return ciil.selectCustomer(id);
    }
}
